package com.example.demo1122.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo1122.entity.Chapter;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;

import java.util.List;

@Mapper
public interface ChapterMapper extends BaseMapper<Chapter> {

    List<Chapter> showChapter(Integer classID);

    @Insert("INSERT INTO chapter (chapterNum, chapterName, courseID) VALUES (#{chapterNum}, #{chapterName}, #{courseID})")
    @Options(useGeneratedKeys = true, keyProperty = "chapterID")
    int insert(Chapter chapter);

    List<Integer> selectChapterIdsByCourseId(Integer courseID);

    int insertChapter(Chapter chapter);

    int updateChapter(Chapter chapter);
}
